<%@page import="com.wanmait.shoppingsys.vo.Trade"%>
<%@page import="com.wanmait.shoppingsys.vo.UserInfo"%>
<%@page import="com.wanmait.shoppingsys.util.Pager"%>
<%@page import="com.wanmait.shoppingsys.vo.Goods"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% 
String path = request.getServletContext().getContextPath();
UserInfo userinfo  =(UserInfo)request.getSession().getAttribute("userinfo");
%>
<jsp:include page="/inc/header.jsp"></jsp:include>
<div class="search_bar clearfix">
		<div class="search_bar clearfix">
		
		<a href="<%=path %>/index.jsp" class="logo fl"><img src="<%=path %>/images/logo.png"></a>
	</div>

		
	</div>

	<div class="main_con clearfix">
		<div class="left_menu_con clearfix">
			<h3>用户中心</h3>
			<ul>
				<li><a href="<%=path %>/userinfo/info.jsp">· 个人信息</a></li>
				<%if(userinfo!=null){ %>
				<li><a href="<%=path %>/GoodsController?action=findAll&id=<%=userinfo.getId() %>" class="active">· 全部订单</a></li>
				<% }else{%>
				<li><a href="<%=path %>" class="active">· 全部订单</a></li>
				<%} %>
				<li><a href="<%=path %>/userinfo/address.jsp">· 收货地址</a></li>
			</ul>
		</div>
		<div class="right_content clearfix">
			<%  Pager pager = (Pager)request.getAttribute("pager");
			ArrayList<Goods> goodses	= (ArrayList<Goods>)pager.getPageDate();
		
				%>
				<h3 class="common_title2">全部订单</h3>
				<%for(int i=0;goodses!=null&&i<goodses.size();i++){
				Goods goods = goodses.get(i);
				%>
				<ul class="order_list_th w978 clearfix">
					<li class="col01">订单号:<%=goods.getOrderNum() %> </li>
					<li class="col02">下单时间:<%=goods.getPayTime() %></li>
					<li class="col02 stress">已支付</li>	
				</ul>
					
				<table class="order_list_table w980">
					<tbody>
						<tr>
							<td width="55%">
								<%for(int j=0;goods.getTrades()!=null&&j<goods.getTrades().size();j++){ 
								    Trade trade = goods.getTrades().get(j);
								%>
								<ul class="order_goods_list clearfix">					
									<li class="col01"><img src="<%=path %>/upload/goods/<%=trade.getSpecialty().getPic() %>"></li>
									<li class="col02"><%=trade.getSpecialty().getName() %></li>	
									<li class="col03"><%=trade.getOrderCount() %></li>
									<li class="col04"><%=trade.getOrderPrice() %>元</li>	
								</ul>
								<%}%>	
							</td>
							<td width="15%"><%=goods.getTotalPrice() %>元</td>
							<td width="15%">已付款</td>
							<td width="15%"><a href="#" class="oper_btn">查看物流</a></td>
						</tr>
					</tbody>
				</table>
		
			<%}%>	
			<div class="pagenation">
				<%if(pager.hasPrev()){ %>
				<a href="<%=path %>/GoodsController?action=findAll&pageNum=<%=pager.getPageNum()-1%>&id=<%=userinfo.getId() %>
				">上一页</a>
				<%} %>
				<%
				for(int i=1;i<=pager.getPageCount();i++){
				%>
				<a href="<%=path %>/GoodsController?action=findAll&pageNum=<%=i%>&id=<%=userinfo.getId() %>"  class="<%=pager.getPageNum()==i?"active":"" %>"  ><%=i %></a>
				<%}%>
				<%if(pager.hasNext()) {%>
				<a href="<%=path %>/GoodsController?action=findAll&pageNum=<%=pager.getPageNum()+1%>&id=<%=userinfo.getId() %>">下一页</a>
				<%} %>	
			</div>
		</div>
		
		
	</div>

				
				

<jsp:include page="/inc/footer.jsp"></jsp:include>
